package cc.mrbird.lsSubmission.controller;

import cc.mrbird.common.annotation.Log;
import cc.mrbird.common.controller.BaseController;
import cc.mrbird.common.domain.QueryRequest;
import cc.mrbird.common.domain.ResponseBo;
import cc.mrbird.handle.domain.Handle;
import cc.mrbird.handle.service.HandleService;
import cc.mrbird.lsSubmission.domain.LsPullDown;
import cc.mrbird.lsSubmission.domain.LsSubmissionEntry;
import cc.mrbird.lsSubmission.service.LsSubmissionService;
import cc.mrbird.submission.util.RestUtil;
import cc.mrbird.submission.util.WXPayUtil;
import cc.mrbird.system.service.UserRoleService;
import org.apache.poi.hssf.usermodel.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class LsSubmissionController extends BaseController {

    @Value("${uploadPath}")
    private String uploadPath;

    @Autowired
    private LsSubmissionService lsSubmissionService;
    @Autowired
    private UserRoleService userRoleService;
    @Autowired
    private HandleService handleService;

    private String cityparvm = null;

    @RequestMapping("lsSubmission")
    public String submission(Model model) {
        cityparvm = "41";
        return "lsSubmission/lsSubmission";
    }
    @Log("增加投诉信息")
    @RequestMapping("lsSubmission/addLsSubmission")
    @ResponseBody
    public ResponseBo addSubmission(HttpServletRequest request, LsSubmissionEntry lsSubmissionEntry, @RequestPart(value="pic",required = false) MultipartFile pic) throws Exception {
        if(lsSubmissionEntry.getPaymentChannels().equals("undefined")){
            lsSubmissionEntry.setPaymentChannels(null);
        }
        if(lsSubmissionEntry.getComplaintChannels().equals("undefined")){
            lsSubmissionEntry.setComplaintChannels(null);
        }
        if(lsSubmissionEntry.getComplaintLine().equals("undefined")){
            lsSubmissionEntry.setComplaintLine(null);
        }
        if(lsSubmissionEntry.getProcessingResults().equals("undefined")){
            lsSubmissionEntry.setProcessingResults(null);
        }
        if(lsSubmissionEntry.getComplaintType().equals("undefined")){
            lsSubmissionEntry.setComplaintType(null);
        }
        if(lsSubmissionEntry.getDutyDetermine().equals("undefined")){
            lsSubmissionEntry.setDutyDetermine(null);
        }
        if(lsSubmissionEntry.getContactInformation().equals("undefined")){
            lsSubmissionEntry.setContactInformation(null);
        }
        if(lsSubmissionEntry.getRegistrar().equals("undefined")){
            lsSubmissionEntry.setRegistrar(null);
        }
        if(lsSubmissionEntry.getHandler().equals("undefined")){
            lsSubmissionEntry.setHandler(null);
        }
        if(lsSubmissionEntry.getRemakes().equals("undefined")){
            lsSubmissionEntry.setRemakes(null);
        }
        if(lsSubmissionEntry.getContentsComplaints().equals("undefined")){
            lsSubmissionEntry.setContentsComplaints(null);
        }
        if(lsSubmissionEntry.getProcessing().equals("undefined")){
            lsSubmissionEntry.setProcessing("26");
        }
        if(lsSubmissionEntry.getFirst().equals("undefined")){
            lsSubmissionEntry.setFirst("48");
        }

        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateString = formatter.format(currentTime);
        lsSubmissionEntry.setAcceptanceTime(dateString);
        String num = lsSubmissionEntry.getCity();
        lsSubmissionEntry.setCity(num);
        lsSubmissionEntry.setFeedback(null);
        if(pic != null){
            String str = pic.getOriginalFilename();
            //截取图片名字之前字符串
            String str1=str.substring(0, str.indexOf("."));
            String frontPicName = str1+String.valueOf((int)((Math.random()*9+1)*1000000000));
            //截取图片名字之后字符串
            String str2=str.substring(0, str.indexOf("."));
            String afterPicName = str.substring(str2.length()+1, str.length());

            String picName = uploadPath + frontPicName+"."+afterPicName;
            File picFile = new File(picName);
            pic.transferTo(picFile);
            lsSubmissionEntry.setPicName(frontPicName+"."+afterPicName);
        }
        lsSubmissionService.saveLsSubmissionEntry(lsSubmissionEntry);
        String subid = lsSubmissionService.findId();
        Long id = super.getCurrentUser().getUserId();
        //190
        if(id == 190){
            WXPayUtil wxPayUtil = new WXPayUtil();
            Map map = new HashMap();
            String idNotice="";
            String content = null;
            if(lsSubmissionEntry.getFirst().equals("48")){
                content = "你好，陵水前台人员有提交新的投诉信息，投诉编号为："+subid+"，请注意查看";
            }else if(lsSubmissionEntry.getFirst().equals("47")){
                content = "你好，优先处理的投诉信息工单，投诉编号为："+subid+"，请注意查看！";
                }
            idNotice = "93";
            String keyid = "2";
            String random_number = wxPayUtil.generateNonceStr();
            String time_stamp = String.valueOf(System.currentTimeMillis());
            String key = "EL6UjSc4U1it6vaFrQ9GlGiMicEbRc0P";
            //通知编号
            map.put("id",idNotice);
            //通知内容
            map.put("content",content);
            //keyid
            map.put("keyid",keyid);
            //随机数
            map.put("random_number",random_number);
            //时间戳
            map.put("time_stamp",time_stamp);
            String sign = wxPayUtil.generateSignature(map,key);
            String url = "http://120.77.182.149:8999/OpenApi/tyxNotice";
            System.out.println(url);
            String data = "id="+idNotice+"&content="+content+"&keyid="+keyid+"&random_number="+random_number+"&time_stamp="+time_stamp+"&sign="+sign;

            RestUtil restUtil = new RestUtil();
            restUtil.interfaceUtil(url,data);
        }
        return ResponseBo.ok();
    }

    @Log("获取投诉信息列表")
    @RequestMapping("lsSubmission/lsSubmissionList")
    @ResponseBody
    public Map<String, Object> submissionList(QueryRequest request, LsSubmissionEntry lsSubmissionEntry) {
        System.out.println(lsSubmissionEntry.getFirst());
        lsSubmissionEntry.setCity("41");
        return super.selectByPageNumSize(request, () -> this.lsSubmissionService.getLsSubmissionEntryList(lsSubmissionEntry));
    }


    @Log("获取投诉信息优先处理列表")
    @RequestMapping("lsSubmission/lsSubmissionFirstList")
    @ResponseBody
    public Map<String, Object> submissionFirstList(QueryRequest request, LsSubmissionEntry lsSubmissionEntry) {
        System.out.println(lsSubmissionEntry.getFirst());
        lsSubmissionEntry.setCity(cityparvm);
        return super.selectByPageNumSize(request, () -> this.lsSubmissionService.getLsSubmissionEntryList(lsSubmissionEntry));
    }

    @Log("根据id获取投诉信息")
    @RequestMapping("lsSubmission/getByLsSubmissionId")
    @ResponseBody
    public ResponseBo getBySubmissionId(LsSubmissionEntry lsSubmissionEntry) {
        String id = lsSubmissionEntry.getId();
        lsSubmissionEntry.setId(id);
        lsSubmissionEntry.setCity(cityparvm);
        return ResponseBo.ok().put("data",lsSubmissionService.getByLsSubmissionId(lsSubmissionEntry));
    }

    @Log("修改投诉信息")
    @RequestMapping("lsSubmission/updateLsSubmission")
    @ResponseBody
    public ResponseBo updateSubmission(LsSubmissionEntry lsSubmissionEntry,@RequestPart(value="pic",required = false) MultipartFile pic) throws Exception {
        if(lsSubmissionEntry.getProcessingResults().equals("undefined")){
            lsSubmissionEntry.setProcessingResults(null);
        }
        if(lsSubmissionEntry.getHandler().equals("undefined")){
            lsSubmissionEntry.setHandler(null);
        }
        if(pic != null){
            String str = pic.getOriginalFilename();
            //截取图片名字之前字符串
            String str1=str.substring(0, str.indexOf("."));
            String frontPicName = str1+String.valueOf((int)((Math.random()*9+1)*1000000000));
            //截取图片名字之后字符串
            String str2=str.substring(0, str.indexOf("."));
            String afterPicName = str.substring(str2.length()+1, str.length());

            String picName = uploadPath + frontPicName+"."+afterPicName;
            File picFile = new File(picName);
            pic.transferTo(picFile);
            lsSubmissionEntry.setPicName(frontPicName+"."+afterPicName);
        }
        Long id = super.getCurrentUser().getUserId();
        if(lsSubmissionEntry.getProcessing().equals("已处理")){
            lsSubmissionEntry.setFirst("48");
        }
        if(id == 190){
            lsSubmissionEntry.setProcessing("未处理");
        }
        if(lsSubmissionEntry.getProcessing().equals("已处理")||lsSubmissionEntry.getProcessing()=="已处理"){
            Date currentTime = new Date();
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String dateString = formatter.format(currentTime);
            lsSubmissionEntry.setProcessingTime(dateString);
        }
        String processingTime = lsSubmissionEntry.getProcessingTime();
        if(processingTime == ""){
            System.out.println("processingTime: "+processingTime);
            lsSubmissionEntry.setProcessingTime(null);
        }
        lsSubmissionService.updateLsSubmission(lsSubmissionEntry);
        return ResponseBo.ok();
    }

    @Log("动态获取下拉选")
    @RequestMapping("lsSubmission/lsPullDown")
    @ResponseBody
    public List<LsPullDown> FindPullDown(LsPullDown lsPullDown) {

            return lsSubmissionService.FindLsPullDown(lsPullDown);

    }
    @Log("增加选配置")
    @RequestMapping("lsSubmission/addLsPullDown")
    @RequiresPermissions("submission:addPullDown")
    @ResponseBody
    public ResponseBo addPullDown(LsPullDown lsPullDown )throws Exception {

        LsPullDown lsPullDown1 = lsSubmissionService.saveLsPullDown(lsPullDown);
        if(lsPullDown1 == null){
            lsSubmissionService.addLsPullDown(lsPullDown);
            return ResponseBo.ok();
        }else{
            return ResponseBo.error("已存在！请重新填写");
        }
    }

    @Log("投诉信息撤销")
    @RequestMapping("lsSubmission/cancelLsSubmission")
    @RequiresPermissions("submission:cancelSubmission")
    @ResponseBody
    public ResponseBo cancelSubmission(LsSubmissionEntry lsSubmissionEntry )throws Exception{
        lsSubmissionEntry.setFirst("48");
        lsSubmissionService.cancelLsSubmission(lsSubmissionEntry);
        return ResponseBo.ok();
    }

    @Log("投诉信息通知技术员")
    @RequestMapping("lsSubmission/lsTechnology")
    @ResponseBody
    public ResponseBo technology(LsSubmissionEntry lsSubmissionEntry )throws Exception{
            Handle handle1 = new Handle();
            handle1.setId(lsSubmissionEntry.getId());
            List<Handle> handleList = handleService.getHandleList(handle1);
            if(handleList.size() == 0){
                LsSubmissionEntry lsSubmissionEntry1  = lsSubmissionService.getLsSubmissionEntry(lsSubmissionEntry);
                Handle handle = new Handle();
                handle.setId(lsSubmissionEntry.getId());
                handle.setAcceptanceTime(lsSubmissionEntry1.getAcceptanceTime());
                handle.setComplaintLine(lsSubmissionEntry1.getComplaintLine());
                handle.setPaymentChannels(lsSubmissionEntry1.getPaymentChannels());
                handle.setComplaintType(lsSubmissionEntry1.getComplaintType());
                handle.setContentsComplaints(lsSubmissionEntry1.getContentsComplaints());
                handle.setRemakes(lsSubmissionEntry1.getRemakes());
                handle.setProcessing("26");
                handleService.saveHandle(handle);
                WXPayUtil wxPayUtil = new WXPayUtil();
                Map map = new HashMap();
                String idNotice = "109";
                //String idNotice = "94";
                String content = null;
                content = "你好，三亚人员有提交新的定位/故障信息，投诉编号为："+lsSubmissionEntry.getId()+"，请注意查看";
                String keyid = "2";
                String random_number = wxPayUtil.generateNonceStr();
                String time_stamp = String.valueOf(System.currentTimeMillis());
                String key = "EL6UjSc4U1it6vaFrQ9GlGiMicEbRc0P";
                //通知编号
                map.put("id",idNotice);
                //通知内容
                map.put("content",content);
                //keyid
                map.put("keyid",keyid);
                //随机数
                map.put("random_number",random_number);
                //时间戳
                map.put("time_stamp",time_stamp);
                String sign = wxPayUtil.generateSignature(map,key);
                String url = "http://120.77.182.149:8999/OpenApi/tyxNotice";
                System.out.println(url);
                String data = "id="+idNotice+"&content="+content+"&keyid="+keyid+"&random_number="+random_number+"&time_stamp="+time_stamp+"&sign="+sign;
                System.out.println("data:"+data);
                RestUtil restUtil = new RestUtil();
                restUtil.interfaceUtil(url,data);
                return ResponseBo.ok();
            }else{
                return ResponseBo.error("已经通知技术员，请不要重复通知");
            }
    }

    @Log("导入excel")
    @RequestMapping("lsSubmission/lsBatchImport")
    @RequiresPermissions("submission:batchImport")
    @ResponseBody
    public boolean lsBatchImport(@RequestParam("file") MultipartFile file) {
        boolean a = false;
        String fileName = file.getOriginalFilename();
        try {
            a = lsSubmissionService.lsBatchImport(fileName, file);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return  a;
    }
    /**
     * 导出投诉信息
     * @param response
     * @param lsSubmissionEntry
     * @return
     */
    @RequestMapping("lsSubmission/lsExportExcel")
    @ResponseBody
    public Object exportExcel(HttpServletResponse response, LsSubmissionEntry lsSubmissionEntry){

        ServletOutputStream outputStream = null;
        HSSFWorkbook workbook = null;
        try {
            // 创建 excel 文件
            workbook = new HSSFWorkbook();
            // 创建一个标签页
            HSSFSheet sheet = workbook.createSheet("用户信息");

            //设置列宽
            sheet.setColumnWidth(0, 3000);
            sheet.setColumnWidth(1, 3000);
            sheet.setColumnWidth(2, 3000);
            sheet.setColumnWidth(3, 3000);
            sheet.setColumnWidth(4, 3000);
            sheet.setColumnWidth(5, 3000);
            sheet.setColumnWidth(6, 3000);
            sheet.setColumnWidth(7, 3000);
            sheet.setColumnWidth(8, 3000);
            sheet.setColumnWidth(9, 3000);
            sheet.setColumnWidth(10, 3000);
            sheet.setColumnWidth(11, 3000);
            sheet.setColumnWidth(12, 3000);
            sheet.setColumnWidth(13, 3000);
            sheet.setColumnWidth(14, 3000);


            //创建格式
            HSSFCellStyle titleStyle = workbook.createCellStyle();
            titleStyle.setWrapText(true);
            titleStyle.setAlignment(HSSFCellStyle.VERTICAL_CENTER);//水平居中
            titleStyle.setVerticalAlignment(HSSFCellStyle.ALIGN_CENTER);//垂直居中


            HSSFFont titleFont = workbook.createFont();
            titleFont.setBold(true);//粗体
            titleFont.setFontHeightInPoints((short)12);//大小
            titleFont.setFontName("宋体");//字体类型
            titleStyle.setFont(titleFont);

            // 创建标题行
            HSSFRow titleRow = sheet.createRow(0);

            HSSFCell cell0 = titleRow.createCell(0);
            cell0.setCellValue("投诉编号");
            cell0.setCellStyle(titleStyle);

            HSSFCell cell1 = titleRow.createCell(1);
            cell1.setCellValue("受理时间");
            cell1.setCellStyle(titleStyle);

            HSSFCell cell2 = titleRow.createCell(2);
            cell2.setCellValue("支付渠道");
            cell2.setCellStyle(titleStyle);

            HSSFCell cell3 = titleRow.createCell(3);
            cell3.setCellValue("投诉渠道");
            cell3.setCellStyle(titleStyle);

            HSSFCell cell4 = titleRow.createCell(4);
            cell4.setCellValue("投诉类别");
            cell4.setCellStyle(titleStyle);

            HSSFCell cell5 = titleRow.createCell(5);
            cell5.setCellValue("联系方式");
            cell5.setCellStyle(titleStyle);

            HSSFCell cell6 = titleRow.createCell(6);
            cell6.setCellValue("投诉路线");
            cell6.setCellStyle(titleStyle);

            HSSFCell cell7 = titleRow.createCell(7);
            cell7.setCellValue("投诉内容");
            cell7.setCellStyle(titleStyle);

            HSSFCell cell8 = titleRow.createCell(8);
            cell8.setCellValue("责任判定");
            cell8.setCellStyle(titleStyle);

            HSSFCell cell9 = titleRow.createCell(9);
            cell9.setCellValue("处理结果");
            cell9.setCellStyle(titleStyle);

            HSSFCell cell10 = titleRow.createCell(10);
            cell10.setCellValue("登记人");
            cell10.setCellStyle(titleStyle);

            HSSFCell cell11 = titleRow.createCell(11);
            cell11.setCellValue("处理时间");
            cell11.setCellStyle(titleStyle);

            HSSFCell cell12 = titleRow.createCell(12);
            cell12.setCellValue("处理人");
            cell12.setCellStyle(titleStyle);

            HSSFCell cell13 = titleRow.createCell(13);
            cell13.setCellValue("公交公司");
            cell13.setCellStyle(titleStyle);

            HSSFCell cell14 = titleRow.createCell(14);
            cell14.setCellValue("处理情况");
            cell14.setCellStyle(titleStyle);

            HSSFCell cell15 = titleRow.createCell(15);
            cell15.setCellValue("城市");
            cell15.setCellStyle(titleStyle);

            //DB查询数据
            lsSubmissionEntry.setCity(cityparvm);
            System.out.println("城市："+cityparvm);
            List<LsSubmissionEntry> userList = lsSubmissionService.getLsSubmissionEntryExportExcel(lsSubmissionEntry);
            System.out.println(userList);
            if(userList == null || userList.isEmpty()){
                return ("导出数据失败，无投诉信息！");
            }


            // 封装excel数据
            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            for (int i = 0; i < userList.size(); i++) {
                System.out.println(userList.size());
                titleRow = sheet.createRow(i + 1);
                //投诉编号
                titleRow.createCell(0).setCellValue(userList.get(i).getId());
                //受理时间
                titleRow.createCell(1).setCellValue(userList.get(i).getAcceptanceTime());
                //支付渠道
                titleRow.createCell(2).setCellValue(userList.get(i).getPaymentChannels());
                //投诉渠道
                titleRow.createCell(3).setCellValue(userList.get(i).getComplaintChannels());
                //投诉类别
                titleRow.createCell(4).setCellValue(userList.get(i).getComplaintType());
                //联系方式
                titleRow.createCell(5).setCellValue(userList.get(i).getContactInformation());
                //投诉线路
                titleRow.createCell(6).setCellValue(userList.get(i).getComplaintLine());
                //投诉内容
                titleRow.createCell(7).setCellValue(userList.get(i).getContentsComplaints());
                //责任判定
                titleRow.createCell(8).setCellValue(userList.get(i).getDutyDetermine());
                //处理结果
                titleRow.createCell(9).setCellValue(userList.get(i).getProcessingResults());
                //登记人
                titleRow.createCell(10).setCellValue(userList.get(i).getRegistrar());
                //处理时间
                titleRow.createCell(11).setCellValue(userList.get(i).getProcessingTime());
                //处理人
                titleRow.createCell(12).setCellValue(userList.get(i).getHandler());
                //公交公司
                titleRow.createCell(13).setCellValue(userList.get(i).getBusCompany());
                //处理情况
                titleRow.createCell(14).setCellValue(userList.get(i).getProcessing());
                //城市
                titleRow.createCell(15).setCellValue(userList.get(i).getCity());

            }
            // 设置两个头 一个输出流
            String filename = "投诉信息表.xls";
                try {
                    outputStream = response.getOutputStream();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                // 响应信息，弹出文件下载窗口
            response.setContentType("APPLICATION/OCTET-STREAM");
                try {
                    response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "utf-8"));
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
                try {
                    workbook.write(outputStream);
                } catch (IOException e) {
                    e.printStackTrace();
                }

            return ResponseBo.error("导出数据失败！");
        } finally {
            try {
                if (outputStream != null) {
                    workbook.close();
                    outputStream.close();
                }
            } catch (Exception e) {
                e.printStackTrace();
                return ResponseBo.error( "导出数据失败！" + e.getMessage());
            }

        }
    }



    /**
     * 投诉系统发送短信给客户
     * @return
     * @throws Exception
     */
                /* 乘客您好：您从${from}上车至${to}下车因未规范扫码导致扣费至全程，经核实现已退费${amount}元原路返回您的${accountname}账户3-5个工作日到账。
        温馨提示，三亚公交车辆分为一票制和分段收费制，乘坐一票制车辆上车只需扫码一次，下车无需扫码。乘坐分段收费车辆，上下车都需扫码，如下次因您个人
        失误不扫码或扫码不成功，均无法给予退费。感谢理解与支持！ */
    @RequestMapping("lsSubmission/lsFebsNotice")
    @ResponseBody
    public ResponseBo febsNotice(String id,String from,String to,String amount,String accountname,String phone) throws Exception {

        WXPayUtil wxPayUtil = new WXPayUtil();
        Map map = new HashMap();
        String idNotice = "110";
        String keyid = "2";
        String random_number = wxPayUtil.generateNonceStr();
        String time_stamp = String.valueOf(System.currentTimeMillis());
        String key = "EL6UjSc4U1it6vaFrQ9GlGiMicEbRc0P";
        //通知编号
        map.put("id",idNotice);
        //通知内容
        map.put("from",from);
        map.put("to",to);
        map.put("amount",amount);
        map.put("accountname",accountname);
        //keyid
        map.put("keyid",keyid);
        //电话号码
        map.put("phone",phone);
        //随机数
        map.put("random_number",random_number);
        //时间戳
        map.put("time_stamp",time_stamp);
        String sign = wxPayUtil.generateSignature(map,key);
        String url = "http://120.77.182.149:8999/OpenApi/febsNotice";
        System.out.println(url);
        String data = "id="+idNotice+"&phone="+phone+"&from="+from+"&to="+to+"&amount="+amount+"&accountname="+accountname+"&keyid="+keyid+"&random_number="+random_number+"&time_stamp="+time_stamp+"&sign="+sign;

        RestUtil restUtil = new RestUtil();
        restUtil.interfaceUtil(url,data);
        System.out.println("id:"+id);
        LsSubmissionEntry lsSubmissionEntry = new LsSubmissionEntry();
        lsSubmissionEntry.setId(id);
        String context = "乘客您好：您从"+from+"上车至"+to+"下车因未规范扫码导致扣费至全程，" +
                "经核实现已退费"+amount+"元原路返回您的"+accountname+"账户3-5个工作日到账。 温馨提示，" +
                "三亚公交车辆分为一票制和分段收费制，乘坐一票制车辆上车只需扫码一次，下车无需扫码。" +
                "乘坐分段收费车辆，上下车都需扫码，如下次因您个人 失误不扫码或扫码不成功，均无法给予退费。感谢理解与支持！";
        lsSubmissionEntry.setFeedback(context);
        lsSubmissionService.updateLsSubmission(lsSubmissionEntry);
        return ResponseBo.ok();
    }

    @Log("优先处理数量")
    @RequestMapping("lsSubmission/lsFirst")
    @ResponseBody
    public LsPullDown first(){
        LsPullDown lsPullDown = new LsPullDown();
        lsPullDown.setSubmissionValue(lsSubmissionService.sumFirst1());
        return lsPullDown;


    }

    /**
     * 对日期的【天】进行加/减
     *
     * @param date 日期
     * @param days 天数，负数为减
     * @return 加/减几天后的日期
     */
    public static Date addDateDays(Date date, int days) {
        DateTime dateTime = new DateTime(date);
        return (Date) dateTime.plusDays(days).toDate();
    }
}
